home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 4.2 KB | 157 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: TextProxy.cpp
- // Release Version: $ 1.0d1 $
- //
- // Author: Anthone Burbidge
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- // ----- Macintosh Includes -----
-
- #ifndef __FIXMATH__
- #include <FixMath.h>
- #endif
-
- #ifndef mathRoutinesIncludes
- #include <math routines.h>
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef _SHAPE_
- #include "Shape.h"
- #endif
-
- // ----- Framework Includes -----
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- // ----- TextPart Includes -----
-
- #ifndef _TEXTPROXY_
- #include "TextProxy.h"
- #endif
-
- #ifndef _TRNSFORM_
- #include <Trnsform.h>
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #pragma segment TextPartSegment
-
-
- //=============================================================================
- // CLASS CTextProxyRun
- //=============================================================================
-
- //-----------------------------------------------------------------------------
- // CTextProxyRun::CTextProxyRun
- //-----------------------------------------------------------------------------
-
- CTextProxyRun::CTextProxyRun()
- {
- }
-
- //-----------------------------------------------------------------------------
- // CTextProxyRun::InitTextProxyRun
- //-----------------------------------------------------------------------------
-
- void CTextProxyRun::InitTextProxyRun(FW_CEmbeddingPart* embeddingPart)
- {
- this->InitProxyRun(embeddingPart);
- }
-
- //-----------------------------------------------------------------------------
- // CTextProxyRun::~CTextProxyRun
- //-----------------------------------------------------------------------------
-
- CTextProxyRun::~CTextProxyRun()
- {
- }
-
- //-----------------------------------------------------------------------------
- // CTextProxyRun::UsedShapeChanged
- //-----------------------------------------------------------------------------
-
- void CTextProxyRun::UsedShapeChanged(XMPFrame* xmpFrame)
- {
- // We assume here that all embedded facets have the same
- // externalTransform
-
- XMPFrameFacetIterator* ite = xmpFrame->CreateFacetIterator();
- XMPFacet *xmpFacet = ite->First();
- delete ite;
-
- if (xmpFacet)
- {
- FW_CRect rect;
- XMPShape *shape = ::NewXMPShape(xmpFrame->GetFrameShape());
- shape->Transform(xmpFacet->GetExternalTransform());
- shape->GetBoundingBox(&rect);
- rect.AsPlatformRect(fBoundingBox);
- delete shape;
- }
-
- FW_CProxyRun::UsedShapeChanged(xmpFrame);
- }
-
- //-----------------------------------------------------------------------------
- // CTextProxyRun::GetFacetExternalTransform
- //-----------------------------------------------------------------------------
-
- void CTextProxyRun::GetFacetExternalTransform(XMPFrame* xmpFrame,
- XMPTransform* facetTransform)
- {
- FW_UNUSED(xmpFrame);
-
- facetTransform->Reset();
- FW_CPoint offset(ff(fBoundingBox.left), ff(fBoundingBox.top));
- facetTransform->MoveBy(offset);
- }
-
- //----------------------------------------------------------------------------------------
- // CTextProxyRun::SetSelectState
- //----------------------------------------------------------------------------------------
-
- void CTextProxyRun::SetSelectState(FW_Boolean state)
- {
- FW_CProxyRun::SetSelectState(state);
-
- // ----- Set the selected flag in facet -----
- BC_TCollectionActiveIterator<FW_CProxyFrame*> ite(*this->GetProxyFrameList());
- while (!ite.IsDone())
- {
- XMPFrameFacetIterator ite2((*ite.CurrentItem())->GetXMPFrame());
- for (XMPFacet* xmpFacet = ite2.First(); ite2.IsNotComplete(); xmpFacet = ite2.Next())
- xmpFacet->SetSelected(state);
- ite.Next();
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CTextProxyRun::SetBoundingBox
- //----------------------------------------------------------------------------------------
-
- void CTextProxyRun::SetBoundingBox(const FW_SPlatformRect& rect)
- {
- fBoundingBox = rect;
- }
-
- //----------------------------------------------------------------------------------------
- // CTextProxyRun::GetBoundingBox
- //----------------------------------------------------------------------------------------
-
- void CTextProxyRun::GetBoundingBox(FW_SPlatformRect& rect) const
- {
- rect = fBoundingBox;
- }
-